package com.smart_environmental_protection.controller;

import com.smart_environmental_protection.pojo.News;
import com.smart_environmental_protection.pojo.Notice;
import com.smart_environmental_protection.service.NewsService;
import com.smart_environmental_protection.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class NewsController {
    @Autowired
    private NewsService newsService;


    @GetMapping("/system/news/list")
    public Map<String,Object> NewsList(){
        Map map=new HashMap<String,Object>();
        List<News> newsList=newsService.NewsList();

        if (newsList!=null){ map.put("success",true);
            map.put("code",200);
            map.put("msg","成功");
            map.put("data",newsList);



        }else {
            map.put("success",false);
            map.put("msg","失败");
        }
        return map;
    }

}
